<!DOCTYPE html>
<html>
<head>
<title>后台管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "./include/resources.html">
</head>
<body class="loginBg">
<div class="loginBox">
	<h1></h1>
	<div class="loginBd">
		<h2></h2>
		<form>
		<ul>
			<li class="msgTip" style="display:none;"></li>
			<li><span class="userIco"></span><input type="text" value="admin123" name="userName" id="userName" autocomplete="off" placeholder="用户名" class="loginTxt"/></li>
			<li><span class="pwdIco"></span><input type="password" value="admin123" name="password" id="password" autocomplete="off" placeholder="密码" class="loginTxt"/></li>
			<li><input type="button" value="立即登录" class="loginBtn"/></li>
		</ul>
		</form>
	</div>
</div>
<script>
	function loginFun() {
		$.ajax({
			type: "post",
			url: "/modules/login",
			dataType:'json',
			data:"userName="+$("#userName").val()+"&password="+$("#password").val(),
			success:function(data){
				if (data.code==="0000") {
					if(document.all){
				        var gotoLink = document.createElement('a');  
				        gotoLink.href = "/modules/home";  
				        document.body.appendChild(gotoLink);  
				        gotoLink.click();
				    }else window.location.href = "/modules/home";
				} else {
					$(".msgTip").show().html(data.msg);
				}
			}
		});
	}
	 $(document).keydown(function(event){ 
		 if(event.keyCode == 13){
			 loginFun();
	   	}
	 });
	 
	 $(document).on({
		 click: function() {
			 loginFun();
		 }
	 },".loginBtn")
	//解决超时登陆界面再iframe框里和panel框里
	if (window != top)
	{
		//top.location.href = location.href;
		parent.window.location.href = location.href;
	}
	if($("#nav").length > 0)
	{
		window.location.reload();
	}
</script>
</body>
</html>